package com.songcha.sakura.mvvm.home.scheduleWeek

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.songcha.library_base.mvvm.base.BaseMvvmFragment
import com.songcha.library_base.mvvm.base.BaseRepository
import com.songcha.sakura.R
import com.songcha.sakura.databinding.FragmentHomeSchduleWeekBinding
import com.songcha.sakura.util.*
import com.songcha.sakura.struct.ComicListBundleData
import com.songcha.sakura.ui.adapter.HomeScheduleWeekAdapter
import com.songcha.sakura.ui.base.BaseComicMvvmFragment


class HomeScheduleWeekFragment : BaseComicMvvmFragment<HomeScheduleWeekViewModel, FragmentHomeSchduleWeekBinding>() {
    companion object{
        val TAG:String= HomeScheduleWeekFragment::class.java.simpleName
    }

    override fun getLayoutId(): Int {
        return R.layout.fragment_home_schdule_week
    }

    override fun initView(savedInstanceState: Bundle?){
        arguments?.let {
            viewModel.list=(it.getSerializable("list") as ComicListBundleData).data
        }
        databinding.rcvSchedule.apply {
            layoutManager=LinearLayoutManager(requireContext())
            val ad=HomeScheduleWeekAdapter(requireContext(),viewModel.list)
            adapter=ad
            ad.setOnItemClickListener{a,v,p->
                MyJumpUtil.toSearchComic(context,viewModel.list[p].title)
            }

        }
    }

    override fun onDestroyView() {
        super.onDestroyView()
        //_binding = null
    }

}